import {ref,computed} from 'vue';
export default function searchData(userData,obj){
    let jsStr = '';
    let searchFilterData = userData;
        Object.keys(obj).forEach((key,i)=>{
        if(obj[key])jsStr += `item.${key} === obj.${key}`;
        if(i<obj.length-1)jsStr += ' && ';
    });
    if(jsStr){
        searchFilterData = ref([]);
        searchFilterData.value = userData.value.filter(item=>{
            return eval(jsStr);
        });
    }
    return {
        searchFilterData
    }
}